package com.mallcloud.mall.mall.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mallcloud.mall.common.core.util.R;
import com.mallcloud.mall.mall.api.entity.vo.MallPointsCouponVO;
import com.mallcloud.mall.mall.service.MallPointsCouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "mall-积分券")
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/mall/pointsCoupon")
public class MallPointsCouponController {
	private final MallPointsCouponService pointCouponService;

	@ApiOperation("分页查询")
	@GetMapping("/page")
	@PreAuthorize("@pms.hasPermission('mall_pointscoupon_view')")
	public R<IPage<MallPointsCouponVO>> page(Page<MallPointsCouponVO> page, MallPointsCouponVO dto) {
		return R.ok(pointCouponService.page(page, dto));
	}

	@ApiOperation("查询详情")
	@GetMapping("/getInfo")
	@PreAuthorize("@pms.hasPermission('mall_pointscoupon_view')")
	public R getInfo(MallPointsCouponVO dto) {
		return R.ok(pointCouponService.getInfo(dto));
	}


}
